import time
import struct
# send_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# print(send_time)

import os
# path = os.path.join(os.getcwd(), os.listdir()[0])
# print(path)
# ls = str(["get_picture",os.path.basename(path),os.stat(path).st_size]).encode("utf-8")
# print(ls)
# f = open(path, "rb")
# w = open("1.py", "wb")
# while True:
#     data = f.read(1024)
#     if len(data) == 0:
#         break
#     print(data)
#     w.write(data)
# f.close()
# w.close()
# from serverer import api_wordsclouds
# ai = api_wordsclouds.get_wordcloud_info("15133854715","17849327316")
# print(ai)
# import requests
# add = requests.Session()
# url = "http://127.0.0.1:4000/add_friend"
# dic = {'username': "15133854715", 'nicheng': "sapple", 'friend_name': "user"}
# print(dic)
# res = add.post(url, dic).text
# print(res)

# import sys
# import os
# curPath = os.path.abspath(os.path.dirname(__file__))
# rootPath = os.path.split(curPath)[0]
# sys.path.append(rootPath)
# print(rootPath)
#

import cv2

cap = cv2.VideoCapture(0)

while(1):
    # 获得图片
    ret, frame = cap.read()
    # 展示图片
    cv2.imshow("capture", frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        # 存储图片
        cv2.imwrite("camera.jpg", frame)
        break
    cv2.imwrite("camera.jpg", frame)
    break


cap.release()
cv2.destroyAllWindows()





